// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use app::spider;
use serde_json::Value;

#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

#[tauri::command]
async fn spider1688(url: &str) -> Result<Value, String> {
    let result = spider::spider1688(url).await;
    Ok(result.unwrap())
}


#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![greet, spider1688])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");

    Ok(())
}

